package cn.liyao.web.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import jdk.nashorn.internal.objects.annotations.Constructor;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;

import javax.persistence.*;
import java.util.Date;




@Entity
@Data
@Table(name = "t_users")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User {


    @Id
    @Column(unique = true,columnDefinition = "VARCHAR(64)")
    private String userId;

    private String userName;

    @JsonIgnore
    private String password;

    private String userPortrait;


    // 省市
    private String provinceCity;
    // 个性签名
    private String signature;

    private String nickName;



    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    @Column(updatable = false)
    private Date regTime;

    public enum Gender {
        MALE, FEMALE, OTHER
    }
    private Gender gender;

    @Transient
    @JsonIgnore
    private String token;


    @Transient
    private Boolean isFriend = false;

    @Transient
    private String remark;


    public User() {

    }

    public void setUserPortrait(String userPortrait) {
        this.userPortrait = userPortrait != null ? userPortrait : "";
    }
}